package io.github.talelin.latticy.model;

import io.github.talelin.latticy.dto.location.LocationDTO;
import io.github.talelin.latticy.dto.location.UpdateLocationDTO;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.beans.BeanUtils;

/**
 * 仓库
 *
 * @author generator@wulongbo
 * @since 2022-06-07
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("location")
@AllArgsConstructor
@NoArgsConstructor
public class LocationDO extends BaseModel {


    /**
     * 仓库id
     */
    private String code;

    /**
     * 区域id
     */
    private Integer areaId;

    /**
     * 库位优先级
     */
    private Integer locationOrder;

    /**
     * 库位名称
     */
    private String name;

    public LocationDO(LocationDTO dto) {
        BeanUtils.copyProperties(dto, this);
    }

    public LocationDO(int id, UpdateLocationDTO dto) {
        BeanUtils.copyProperties(dto, this);
        this.setId(id);
    }

}
